package com.shimmer.CRUD;

import com.shimmer.dao.UserDao;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Package com.shimmer.CRUD
 * @Author shimmer
 * @Date 2020/8/16 14:42
 * @TODO
 */
public class DeleteServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int id = Integer.parseInt(req.getParameter("id"));
        new UserDao().deleteUserById(id);
        resp.sendRedirect("retrieve");
    }
}
